﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>登录</title>
    <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
    <script src="~/Content/layui/layui.js"></script>
    <style>
        .ziti {
            text-align: left;
            font-size: 20px;
            color: #fff;
        }
    </style>
</head>
<body style="background-image:url(../../images/luca-micheli-580612-unsplash.jpg);background-repeat:no-repeat; background-size:100% 100%;">
    <div class="layui-container" style="height:900px;">
        <div class="layui-row">
            <div class="layui-col-md4">
                <div style="width:100%;opacity: 0;">
                    W
                </div>
            </div>
            <div class="layui-col-md4">
                <div style="width:100%;padding-top: 240px;">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;text-align:center;">
                        <legend>Wei 博客 后台管理</legend>
                    </fieldset>
                    <form class="layui-form">
                        <div class="layui-form-item">
                            <label class="layui-form-label ziti">账号：</label>
                            <div class="layui-input-block">
                                <input type="text" id="email" name="email" required lay-verify="required" placeholder="请输入账号" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label ziti">密码：</label>
                            <div class="layui-input-block">
                                <input type="password" id="pwd" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="button" class="layui-btn" onclick="login()">立即登录</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="layui-col-md4">
                <div style="width:100%;opacity: 0;">
                    W
                </div>
            </div>
        </div>
    </div>
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script>
        var layer;
        layui.use('layer', function () {
            layer = layui.layer;
        });
        function login() {
            if ($("#email").val() == "") {
                layer.alert('请输入账号');
                return;
            }
            if ($("#pwd").val() == "") {
                layer.alert('请输入密码');
                return;
            }
            layer.load(1);
            $.ajax({
                url: '/Admin/Home/Login',
                type: 'POST',
                data: {
                    email: $("#email").val(),
                    password:$("#pwd").val()
                },
                dataType: 'text',
                success: function (data) {
                    layer.closeAll('loading');
                    if (data == "ok") {
                        location.href = "/Admin/Home/Index";
                    } else {
                        layer.alert(data, false);
                        return false;
                    }
                }
            });
        }
    </script>
</body>
</html>
